package org.edu.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.annotations.Proxy;

@Entity
@Proxy(lazy = false)
@Table(name = "ROLES", catalog = "SCHOOL")
public class Roles implements Serializable {

	private static final long serialVersionUID = 1L;

	private Long roles_id;
	private Set<User> users = new HashSet<>();
	private String description;
	private Boolean actions;
	private Boolean profil_actions;
	private Boolean user_actions;
	private Boolean all_user;
	private Boolean all_student;
	private Boolean all_teacher;
	private Boolean all_lesson;
	private Boolean semester_lessons;
	private Boolean semester_notes;
	private Boolean adding_lesson_teacher;
	private Boolean teacher_affairs;
	private Boolean all_project;
	private Boolean notes_project;
	private Boolean notes_lesson;
	private Boolean student_affairs;
	private Boolean choose_project;
	private Boolean choose_lesson;
	private Boolean account_settings;
	private Boolean change_password;
	private Boolean edit_profil;
	private Boolean delete_account;
	
	private Boolean panel_admin;
	private Boolean panel_teacher;
	private Boolean panel_student;
	private Boolean form_new_student;
	private Boolean form_new_teacher;
	private Boolean tab_admin;
	private Boolean tab_teacher;
	private Boolean tab_student;

	@Id
	@GeneratedValue
	@Column(name = "ROLES_ID", nullable = false)
	public Long getRoles_id() {
		return roles_id;
	}

	public void setRoles_id(Long roles_id) {
		this.roles_id = roles_id;
	}

	@OneToMany(targetEntity = User.class, mappedBy = "roles", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@LazyCollection(LazyCollectionOption.FALSE)
	public Set<User> getUsers() {
		return users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

	@Column(name = "DESCRIPTION", length = 40)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "ACTIONS")
	public Boolean getActions() {
		return actions;
	}

	public void setActions(Boolean actions) {
		this.actions = actions;
	}

	@Column(name = "PROFIL_ACTIONS")
	public Boolean getProfil_actions() {
		return profil_actions;
	}

	public void setProfil_actions(Boolean profil_actions) {
		this.profil_actions = profil_actions;
	}

	@Column(name = "USER_ACTIONS")
	public Boolean getUser_actions() {
		return user_actions;
	}

	public void setUser_actions(Boolean user_actions) {
		this.user_actions = user_actions;
	}

	@Column(name = "ALL_USER")
	public Boolean getAll_user() {
		return all_user;
	}

	public void setAll_user(Boolean all_user) {
		this.all_user = all_user;
	}

	@Column(name = "ALL_STUDENT")
	public Boolean getAll_student() {
		return all_student;
	}

	public void setAll_student(Boolean all_student) {
		this.all_student = all_student;
	}

	@Column(name = "ALL_TEACHER")
	public Boolean getAll_teacher() {
		return all_teacher;
	}

	public void setAll_teacher(Boolean all_teacher) {
		this.all_teacher = all_teacher;
	}

	@Column(name = "ALL_LESSON")
	public Boolean getAll_lesson() {
		return all_lesson;
	}

	public void setAll_lesson(Boolean all_lesson) {
		this.all_lesson = all_lesson;
	}

	@Column(name = "SEMESTER_LESSONS")
	public Boolean getSemester_lessons() {
		return semester_lessons;
	}

	public void setSemester_lessons(Boolean semester_lessons) {
		this.semester_lessons = semester_lessons;
	}

	@Column(name = "ADDING_LESSON_TEACHER")
	public Boolean getAdding_lesson_teacher() {
		return adding_lesson_teacher;
	}

	public void setAdding_lesson_teacher(Boolean adding_lesson_teacher) {
		this.adding_lesson_teacher = adding_lesson_teacher;
	}

	@Column(name = "TEACHER_AFFAIRS")
	public Boolean getTeacher_affairs() {
		return teacher_affairs;
	}

	public void setTeacher_affairs(Boolean teacher_affairs) {
		this.teacher_affairs = teacher_affairs;
	}

	@Column(name = "ALL_PROJECT")
	public Boolean getAll_project() {
		return all_project;
	}

	public void setAll_project(Boolean all_project) {
		this.all_project = all_project;
	}
	
	@Column(name = "NOTES_PROJECT")
	public Boolean getNotes_project() {
		return notes_project;
	}

	public void setNotes_project(Boolean notes_project) {
		this.notes_project = notes_project;
	}

	@Column(name = "NOTES_LESSON")
	public Boolean getNotes_lesson() {
		return notes_lesson;
	}

	public void setNotes_lesson(Boolean notes_lesson) {
		this.notes_lesson = notes_lesson;
	}

	@Column(name = "STUDENT_AFFAIRS")
	public Boolean getStudent_affairs() {
		return student_affairs;
	}

	public void setStudent_affairs(Boolean student_affairs) {
		this.student_affairs = student_affairs;
	}

	@Column(name = "CHOOSE_PROJECT")
	public Boolean getChoose_project() {
		return choose_project;
	}

	public void setChoose_project(Boolean choose_project) {
		this.choose_project = choose_project;
	}

	@Column(name = "CHOOSE_LESSON")
	public Boolean getChoose_lesson() {
		return choose_lesson;
	}

	public void setChoose_lesson(Boolean choose_lesson) {
		this.choose_lesson = choose_lesson;
	}

	@Column(name = "ACCOUNT_SETTINGS")
	public Boolean getAccount_settings() {
		return account_settings;
	}

	public void setAccount_settings(Boolean account_settings) {
		this.account_settings = account_settings;
	}

	@Column(name = "CHANGE_PASSWORD")
	public Boolean getChange_password() {
		return change_password;
	}

	public void setChange_password(Boolean change_password) {
		this.change_password = change_password;
	}

	@Column(name = "EDIT_PROFIL")
	public Boolean getEdit_profil() {
		return edit_profil;
	}

	public void setEdit_profil(Boolean edit_profil) {
		this.edit_profil = edit_profil;
	}

	@Column(name = "DELETE_ACCOUNT")
	public Boolean getDelete_account() {
		return delete_account;
	}

	public void setDelete_account(Boolean delete_account) {
		this.delete_account = delete_account;
	}
	
	@Column(name = "PANEL_ADMIN")
	public Boolean getPanel_admin() {
		return panel_admin;
	}

	public void setPanel_admin(Boolean panel_admin) {
		this.panel_admin = panel_admin;
	}

	@Column(name = "PANEL_TEACHER")
	public Boolean getPanel_teacher() {
		return panel_teacher;
	}

	public void setPanel_teacher(Boolean panel_teacher) {
		this.panel_teacher = panel_teacher;
	}

	@Column(name = "PANEL_STUDENT")
	public Boolean getPanel_student() {
		return panel_student;
	}

	public void setPanel_student(Boolean panel_student) {
		this.panel_student = panel_student;
	}
	
	@Column(name = "FORM_NEW_STUDENT")
	public Boolean getForm_new_student() {
		return form_new_student;
	}

	public void setForm_new_student(Boolean form_new_student) {
		this.form_new_student = form_new_student;
	}

	@Column(name = "FORM_NEW_TEACHER")
	public Boolean getForm_new_teacher() {
		return form_new_teacher;
	}

	public void setForm_new_teacher(Boolean form_new_teacher) {
		this.form_new_teacher = form_new_teacher;
	}
	
	@Column(name = "SEMESTER_NOTES")
	public Boolean getSemester_notes() {
		return semester_notes;
	}

	public void setSemester_notes(Boolean semester_notes) {
		this.semester_notes = semester_notes;
	}

	@Column(name = "TAB_ADMIN")
	public Boolean getTab_admin() {
		return tab_admin;
	}

	public void setTab_admin(Boolean tab_admin) {
		this.tab_admin = tab_admin;
	}

	@Column(name = "TAB_TEACHER")
	public Boolean getTab_teacher() {
		return tab_teacher;
	}

	public void setTab_teacher(Boolean tab_teacher) {
		this.tab_teacher = tab_teacher;
	}

	@Column(name = "TAB_STUDENT")
	public Boolean getTab_student() {
		return tab_student;
	}

	public void setTab_student(Boolean tab_student) {
		this.tab_student = tab_student;
	}

	public Roles() {
		super();
	}
	
	public Roles(Long roles_id) {
		super();
		this.roles_id = roles_id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((account_settings == null) ? 0 : account_settings.hashCode());
		result = prime * result + ((actions == null) ? 0 : actions.hashCode());
		result = prime
				* result
				+ ((adding_lesson_teacher == null) ? 0 : adding_lesson_teacher
						.hashCode());
		result = prime * result
				+ ((all_lesson == null) ? 0 : all_lesson.hashCode());
		result = prime * result
				+ ((all_project == null) ? 0 : all_project.hashCode());
		result = prime * result
				+ ((all_student == null) ? 0 : all_student.hashCode());
		result = prime * result
				+ ((all_teacher == null) ? 0 : all_teacher.hashCode());
		result = prime * result
				+ ((all_user == null) ? 0 : all_user.hashCode());
		result = prime * result
				+ ((change_password == null) ? 0 : change_password.hashCode());
		result = prime * result
				+ ((choose_lesson == null) ? 0 : choose_lesson.hashCode());
		result = prime * result
				+ ((choose_project == null) ? 0 : choose_project.hashCode());
		result = prime * result
				+ ((delete_account == null) ? 0 : delete_account.hashCode());
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		result = prime * result
				+ ((edit_profil == null) ? 0 : edit_profil.hashCode());
		result = prime
				* result
				+ ((form_new_student == null) ? 0 : form_new_student.hashCode());
		result = prime
				* result
				+ ((form_new_teacher == null) ? 0 : form_new_teacher.hashCode());
		result = prime * result
				+ ((notes_lesson == null) ? 0 : notes_lesson.hashCode());
		result = prime * result
				+ ((notes_project == null) ? 0 : notes_project.hashCode());
		result = prime * result
				+ ((panel_admin == null) ? 0 : panel_admin.hashCode());
		result = prime * result
				+ ((panel_student == null) ? 0 : panel_student.hashCode());
		result = prime * result
				+ ((panel_teacher == null) ? 0 : panel_teacher.hashCode());
		result = prime * result
				+ ((profil_actions == null) ? 0 : profil_actions.hashCode());
		result = prime * result
				+ ((roles_id == null) ? 0 : roles_id.hashCode());
		result = prime
				* result
				+ ((semester_lessons == null) ? 0 : semester_lessons.hashCode());
		result = prime * result
				+ ((semester_notes == null) ? 0 : semester_notes.hashCode());
		result = prime * result
				+ ((student_affairs == null) ? 0 : student_affairs.hashCode());
		result = prime * result
				+ ((tab_admin == null) ? 0 : tab_admin.hashCode());
		result = prime * result
				+ ((tab_student == null) ? 0 : tab_student.hashCode());
		result = prime * result
				+ ((tab_teacher == null) ? 0 : tab_teacher.hashCode());
		result = prime * result
				+ ((teacher_affairs == null) ? 0 : teacher_affairs.hashCode());
		result = prime * result
				+ ((user_actions == null) ? 0 : user_actions.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Roles other = (Roles) obj;
		if (account_settings == null) {
			if (other.account_settings != null)
				return false;
		} else if (!account_settings.equals(other.account_settings))
			return false;
		if (actions == null) {
			if (other.actions != null)
				return false;
		} else if (!actions.equals(other.actions))
			return false;
		if (adding_lesson_teacher == null) {
			if (other.adding_lesson_teacher != null)
				return false;
		} else if (!adding_lesson_teacher.equals(other.adding_lesson_teacher))
			return false;
		if (all_lesson == null) {
			if (other.all_lesson != null)
				return false;
		} else if (!all_lesson.equals(other.all_lesson))
			return false;
		if (all_project == null) {
			if (other.all_project != null)
				return false;
		} else if (!all_project.equals(other.all_project))
			return false;
		if (all_student == null) {
			if (other.all_student != null)
				return false;
		} else if (!all_student.equals(other.all_student))
			return false;
		if (all_teacher == null) {
			if (other.all_teacher != null)
				return false;
		} else if (!all_teacher.equals(other.all_teacher))
			return false;
		if (all_user == null) {
			if (other.all_user != null)
				return false;
		} else if (!all_user.equals(other.all_user))
			return false;
		if (change_password == null) {
			if (other.change_password != null)
				return false;
		} else if (!change_password.equals(other.change_password))
			return false;
		if (choose_lesson == null) {
			if (other.choose_lesson != null)
				return false;
		} else if (!choose_lesson.equals(other.choose_lesson))
			return false;
		if (choose_project == null) {
			if (other.choose_project != null)
				return false;
		} else if (!choose_project.equals(other.choose_project))
			return false;
		if (delete_account == null) {
			if (other.delete_account != null)
				return false;
		} else if (!delete_account.equals(other.delete_account))
			return false;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (edit_profil == null) {
			if (other.edit_profil != null)
				return false;
		} else if (!edit_profil.equals(other.edit_profil))
			return false;
		if (form_new_student == null) {
			if (other.form_new_student != null)
				return false;
		} else if (!form_new_student.equals(other.form_new_student))
			return false;
		if (form_new_teacher == null) {
			if (other.form_new_teacher != null)
				return false;
		} else if (!form_new_teacher.equals(other.form_new_teacher))
			return false;
		if (notes_lesson == null) {
			if (other.notes_lesson != null)
				return false;
		} else if (!notes_lesson.equals(other.notes_lesson))
			return false;
		if (notes_project == null) {
			if (other.notes_project != null)
				return false;
		} else if (!notes_project.equals(other.notes_project))
			return false;
		if (panel_admin == null) {
			if (other.panel_admin != null)
				return false;
		} else if (!panel_admin.equals(other.panel_admin))
			return false;
		if (panel_student == null) {
			if (other.panel_student != null)
				return false;
		} else if (!panel_student.equals(other.panel_student))
			return false;
		if (panel_teacher == null) {
			if (other.panel_teacher != null)
				return false;
		} else if (!panel_teacher.equals(other.panel_teacher))
			return false;
		if (profil_actions == null) {
			if (other.profil_actions != null)
				return false;
		} else if (!profil_actions.equals(other.profil_actions))
			return false;
		if (roles_id == null) {
			if (other.roles_id != null)
				return false;
		} else if (!roles_id.equals(other.roles_id))
			return false;
		if (semester_lessons == null) {
			if (other.semester_lessons != null)
				return false;
		} else if (!semester_lessons.equals(other.semester_lessons))
			return false;
		if (semester_notes == null) {
			if (other.semester_notes != null)
				return false;
		} else if (!semester_notes.equals(other.semester_notes))
			return false;
		if (student_affairs == null) {
			if (other.student_affairs != null)
				return false;
		} else if (!student_affairs.equals(other.student_affairs))
			return false;
		if (tab_admin == null) {
			if (other.tab_admin != null)
				return false;
		} else if (!tab_admin.equals(other.tab_admin))
			return false;
		if (tab_student == null) {
			if (other.tab_student != null)
				return false;
		} else if (!tab_student.equals(other.tab_student))
			return false;
		if (tab_teacher == null) {
			if (other.tab_teacher != null)
				return false;
		} else if (!tab_teacher.equals(other.tab_teacher))
			return false;
		if (teacher_affairs == null) {
			if (other.teacher_affairs != null)
				return false;
		} else if (!teacher_affairs.equals(other.teacher_affairs))
			return false;
		if (user_actions == null) {
			if (other.user_actions != null)
				return false;
		} else if (!user_actions.equals(other.user_actions))
			return false;
		return true;
	}
	
}
